#include <ctype.h>
#include <limits.h>
#include <math.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
#include <iso646.h>

char str[1000010];
int nexts[1000010];

int getNext(char*);

int main()
{
	scanf("%s", str);
	while (str[0] != '.') {
		int size = getNext(str), span;
		if (size % (span = size - nexts[size]) == 0) printf("%d\n", size / span);
		else printf("%d\n", 1);
		scanf("%s", str);
	}
	return 0;
}

int getNext(char* str) {
	nexts[0] = -1;
	int i = 0;
	for (int pre = -1, ch; (ch = str[i]); ) {
		if (pre == -1 || ch == str[pre]) nexts[++i] = ++pre;
		else pre = nexts[pre];
	}
	return i;
}
